<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../style/bootstrap.min.css"/>
    <script type="text/javascript" src="../scripts/jquery.js"></script>
    <script type="text/javascript" src="../scripts/bootstrap.js"></script>
    <script>
        function selectChange() {
            var chkSelectAll = document.getElementById("checkAll");
            var checked = chkSelectAll.checked;
            if (checked) {
                // select all products
                selectAllItem();
            } else {
                //unselect all products
                unSelectAll();
            }
        }

        //选择全部
        function selectAllItem() {
            var items = document.getElementsByName("id");
            for (var i = 0; i < items.length; i++) {
                items[i].checked = true;
            }
        }

        //取消全选
        function unSelectAll() {
            var items = document.getElementsByName("id");
            for (var i = 0; i < items.length; i++) {
                items[i].checked = false;
            }
        }

    </script>
    <script>
        function tij(){
            if(confirm("是否确定提交审核？")){
                var ids = document.getElementsByName("id");
                var id = 0;
                for (var i = 0; i < ids.length; i++) {
                    if (ids[i].checked) {
                        id = ids[i].value;
                    }
                }
                window.location.href="/AuditPlan/submitPlan?id="+id;
            }
        }

        function zz(){
            if(confirm("是否确定终止计划？")){
                var ids = document.getElementsByName("id");
                var id = 0;
                for (var i = 0; i < ids.length; i++) {
                    if (ids[i].checked) {
                        id = ids[i].value;
                    }
                }
                window.location.href="/AuditPlan/zzPlan?id="+id;
            }
        }



    </script>

</head>

<body>

<div class="container">
    <!--
    <div class="row">
        <form action="" method="post">
            <div class="row">
                <div class="col-xs-2 text-right">
                    计划年度:
                    <select class="selected btn-xs" style="width: 80px;">
                        <option class="active"></option>
                        <option>1</option>
                        <option>2</option>
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-6 text-right">
                    <input type="submit" value="查询" class="btn-primary"/>
                    <input type="reset" value="重置" class="btn-primary"/>
                </div>
            </div>
        </form>
    </div>
    -->
    <div class="row">
        <div class="col-xs-6">

            <span>年度计划确认</span>

        </div>
        <div class="caption col-xs-2 text-right">

            <input class="btn-primary" type="button" value="增加" data-toggle="modal" data-target="#insert">

        </div>
        <div class="caption col-xs-2 text-right">

            <input class="btn-danger" onclick="zz()" type="button" value="终止计划">

        </div>
        <div class="caption col-xs-2 text-right">

            <input class="btn-success" onclick="tij()" type="button" value="提交审核">

        </div>

        </table>
    </div>
    <div style="height: 400px;">
        <table class="table table-striped table-hover table-condensed">
            <tr>
                <th><input type="checkbox" id="checkAll" onclick="selectChange()"></th>
                <th>计划年度</th>
                <th>计划名称</th>
                <th>审计机构</th>
                <th>计划类型</th>
                <th>计划状态</th>
                <th>创建人</th>
                <th>创建时间</th>
            </tr>
            <tr th:each="plans:${auditplans}">
                <td><input type="checkbox" name="id" th:value="${plans.AuditPlan.id}"></td>
                <td th:text="${#dates.format(plans.AuditPlan.year,'yyyy-MM-dd')}">xx年</td>
                <td th:text="${plans.AuditPlan.name}">xxx名</td>
                <td th:text="${plans.auditInstitution.auditname}">xx机构</td>
                <td>
                    <span th:if="${plans.AuditPlan.type==1}">公司类</span>
                    <span th:if="${plans.AuditPlan.type==2}">营业类</span>
                </td>
                <td>
                    <span th:if="${plans.AuditPlan.status==0}">已终止</span>
                    <span th:if="${plans.AuditPlan.status==1}">未开始</span>
                    <span th:if="${plans.AuditPlan.status==2}">审核中</span>
                    <span th:if="${plans.AuditPlan.status==3}">已审核</span>
                    <span th:if="${plans.AuditPlan.status==4}">已完成</span>
                </td>
                <td th:text="${plans.AuditPlan.creationname}">创建xx人</td>
                <td th:text="${plans.AuditPlan.creationdate}">创建xx时间</td>
            </tr>
        </table>
    </div>
    <div class="table_down-nav">
        <div class="page">
            <form action="#" method="post" name="">
                <a href="#"><i class="glyphicon glyphicon-step-backward"></i></a>
                <a href="#"><i class="glyphicon glyphicon-chevron-left"></i></a> 第
                <input type="text" name=""/> 页， 共 <span name=></span> 页
                <a href="#"><i class="glyphicon glyphicon-chevron-right"></i></a>
                <a href="#"><i class="glyphicon glyphicon-step-forward"></i></a>
            </form>
        </div>
    </div>
    <!--
    <div>
        <table class="table">
            <tr>
                <th>类型</th>
                <th>项目总数</th>
                <th>开展中个数</th>
                <th>完成个数</th>
                <th>完成占比</th>
            </tr>
            <tr>
                <th>年度计划</th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
            </tr>
            <tr>
                <th>新增计划</th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
            </tr>
            <tr>
                <th>合计</th>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
            </tr>
        </table>
    </div>
    -->
</div>

<!--增加的模态框-->
<div class="modal fade" id="insert">
    <div class="modal-dialog">
        <div class="modal-content" style="width: 450px;">
            <form action="/AuditPlan/addPlan">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal">×</button>
                    <h4>增加计划</h4>
                </div>
                <div class="media-body container">
                    <table class="unit-the-table table">
                        <tr>
                            <td>计划年度:</td>
                            <td>
                                <input type="text" name="year">
                            </td>
                        </tr>
                        <tr>
                            <td>计划类型:</td>
                            <td>
                                <select name="type">
                                    <option value="1">公司类</option>
                                    <option value="2">营业类</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>审计机构:</td>
                            <td>
                                <select name="institutions">
                                    <option th:each="inst:${ins}"
                                            th:value="${inst.id}"
                                            th:text="${inst.auditname}">
                                    </option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>计划名称:</td>
                            <td>
                                <input type="text" name="name"/>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="modal-footer">
                    <input type="submit" class="btn btn-info btn-block" value="保存"/>
                    <input type="reset" class="btn btn-warning btn-block" value="重置"/>
                </div>
            </form>
        </div>
    </div>
</div>
<!--结束-->
</body>

</html>